{% load i18n %}
{% load comments %}
{% load report_tags %}
{% load static %}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>{{ testrun.summary }}</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="Content-Language" content="utf-8" />
	<link rel="stylesheet" type="text/css" href="{% static 'style/print.css' %}" media="all" />
</head>
<body>
	<div class="report_title">
            {% trans "Test Execution Report" %}
	<div class="report_sub_title"><a href='{% url "testruns-get" test_run.run_id %}'>[{{ test_run.run_id }}] {{ test_run.summary }}</a></div></div>
	<div class="report_content">
	<div id="content">
		<div class="listinfo_content" style="float:left; width:95%">
			<div class="leftlistinfo">
				<div class="listinfo">
                                    <span class="title">{% trans "Test Plan" %}:</span>{{ test_run.plan.plan_id }}:{{ test_run.plan.name }}
				</div>
				<div class="listinfo">
                                    <span class="title">{% trans "Product Version" %}:</span>{{ test_run.product_version }}
				</div>
				<div class="listinfo">
                                    <span class="title">{% trans "Manager" %}:</span>{{ test_run.manager.username }}
				</div>
			</div>
			<div class="rightlistinfo">
				<div class="listinfo">
                                    <span class="title">{% trans "Product" %}:</span>{{ test_run.build.product }}
				</div>
				<div class="listinfo">
                                    <span class="title">{% trans "Build" %}:</span>{{ test_run.build }}
				</div>
				<div class="listinfo">
                                    <span class="title">{% trans "Default Tester" %}:</span>{{ test_run.default_tester }}
				</div>
				<div class="listinfo">
                                    <span class="title">{% trans "Started at" %}:</span>{{ test_run.start_date }}
				</div>
				<div class="listinfo">
                                    <span class="title">{% trans "Finished at" %}:</span>{{ test_run.stop_date }}
				</div>
			</div>
			<div class="listinfo">
                            <span class="title">{% trans "Note" %}:</span>{{ test_run.notes|urlize|linebreaksbr }}
			</div>
			<div class="clear"></div>
		</div>
		<div class="clear"></div>
		<div class="table_noborder">
                    {% trans "Manual Cases" %}<span class="red">{{ mode_stats.manual|percentage:executions_count }}({{ mode_stats.manual }}/{{ executions_count }})</span>
                    {% trans "Automated Cases" %}<span class="red">{{ mode_stats.automated|percentage:executions_count }}({{ mode_stats.automated }}/{{ executions_count }})</span>
		</div>

		{% if executions %}
		<table class="list border-1" cellpadding="0" cellspacing="0">
			<tr>
                            <th class="widthID">{% trans "Case-Run ID" %}</th>
                            <th class="widthID">{% trans "Case ID" %}</th>
                            <th>{% trans "Summary" %}</th>
                            <th width="100">{% trans "Automated" %}</th>
                            <th width="100">{% trans "Tested by" %}</th>
                            <th width="150">{% trans "Category" %}</th>
                            <th width="100">{% trans "Status" %}</th>
                            <th width="160" height="25px">{% trans "Closed at" %}</th>
			</tr>
			{% for execution in executions %}
			<tr>
				<td>{{ execution.case_run_id }}</td>
				<td>{{ execution.case_id }}</td>
				<td>{{ execution.case.summary }}</td>
				<td>{{ execution.case.is_automated }}</td>
				<td>{{ execution.tested_by.username }}</td>
				<td>{{ execution.case.category.name }}</td>
				<td><span class="highlight">{{ execution.status.name|upper }}</span></td>
				<td>{{ execution.close_date }}</td>
			</tr>
			<tr>
				<td align="left" valign="top" colspan="8" class='hide'>
					{% if execution.bugs %}
                                        <span class='notes_title'>{% trans "Bugs ID" %}:</span>
					{% for bug in execution.bugs %}
					<a href="{{ bug.bug_url }}">{{ bug.bug_id }}</a>
					{% endfor %}
					{% endif %}

					{% if execution.user_comments %}
					<h4 style='padding:0px;margin:0px'>Comments</h4>
					<span class="notes" >
						<ul style="margin-left:10px;" class='comment'>
							{% for comment in execution.user_comments %}
							<li><b>{{ comment.user_name }}</b><span class='grey' style='margin-left:5px'>[{{ comment.submit_date }}]</span>	<br />{{ comment.comment|urlize|linebreaksbr }}</li>
							{% endfor %}
						</ul>
					</span> 
					{% endif %}

					</td>
			</tr>
			{% endfor %}
		</table>
		{% endif %}

		<h3>Total: {{ executions_count }}</h3>
		<h3>Pending test cases: {{ summary_stats.idle }}</h3>
		<h3>Test run completed: {{ summary_stats.complete|percentage:executions_count }}</h3>

		{% if execution_bugs %}
		<hr style="margin:40px auto 20px;"/>
                <h2><a name="buglist" style="cursor:default; text-decoration:none">{% trans "Bug List" %}:</a></h2>

		<table	class="list border-1" cellpadding="0" cellspacing="0">
			<tr>
                            <th width="150px">{% trans "Bug ID" %}</th>
                            <th>{% trans "Bug Url" %}</th>
			</tr>
			{% for bug, bug_url in execution_bugs %}
			<tr>
				<td>{{ bug }}</td>
				<td><a href="{{ bug_url }}" target="_blank">{{ bug_url }}</a></td>
			</tr>
			{% endfor %}
		</table>
		{% endif %}

		{% if report_urls %}
                <h2>{% trans "View all in Issue Tracker" %}</h2>
                <em>{% trans "Only configured ITs which support multiple bugs are shown" %}</em>
		<table class="list border-1" cellpadding="0" cellspacing="0">
			<tr>
                            <th width="150px">{% trans "Tracker" %}</th>
                            <th>{% trans "URL" %}</th>
			</tr>
			{% for name, report_url in report_urls %}
			<tr>
				<td>{{ name }}</td>
				<td><a href="{{ report_url }}" target="_blank">{{ report_url }}</a></td>
			</tr>
			{% endfor %}
		</table>
		{% endif %}
	</div>
	</div>
</body>
</html>
